package me.ydq.core.sql;

import me.ydq.core.SqlSpec;
import me.ydq.misc.Fn;

import java.util.Collection;
import java.util.function.Supplier;

public interface SqlNotIn<T> {

    SqlSpec<T> notIn(Fn<T, ?> fn, Collection<?> value);

    SqlSpec<T> notIn(String column, Collection<?> value);

    default SqlSpec<T> notIn(Supplier<Boolean> condition, Fn<T, ?> fn, Supplier<Collection<?>> valGet) {
        return notIn(Boolean.TRUE.equals(condition.get()), fn, valGet);
    }

    default SqlSpec<T> notIn(Supplier<Boolean> condition, Fn<T, ?> fn, Collection<?> val) {
        return notIn(Boolean.TRUE.equals(condition.get()), fn, val);
    }

    default SqlSpec<T> notIn(boolean condition, Fn<T, ?> fn, Supplier<Collection<?>> valGet) {
        return condition ? notIn(fn, valGet.get()) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notIn(boolean condition, Fn<T, ?> fn, Collection<?> val) {
        return condition ? notIn(fn, val) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notIn(Fn<T, ?> fn, Supplier<Collection<?>> valGet) {
        return notIn(fn, valGet.get());
    }

    default SqlSpec<T> notIn(Supplier<Boolean> condition, String rawColumn, Supplier<Collection<?>> valGet) {
        return notIn(Boolean.TRUE.equals(condition.get()), rawColumn, valGet);
    }

    default SqlSpec<T> notIn(Supplier<Boolean> condition, String rawColumn, Collection<?> val) {
        return notIn(Boolean.TRUE.equals(condition.get()), rawColumn, val);
    }

    default SqlSpec<T> notIn(boolean condition, String rawColumn, Supplier<Collection<?>> valGet) {
        return condition ? notIn(rawColumn, valGet.get()) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notIn(boolean condition, String rawColumn, Collection<?> val) {
        return condition ? notIn(rawColumn, val) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notIn(String rawColumn, Supplier<Collection<?>> valGet) {
        return notIn(rawColumn, valGet.get());
    }

}
